package com.api.regression.group.getgroup;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.test.context.ContextConfiguration;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import com.api.test.AbstractApiTest;
import com.zyncro.api.IGroupApiService;
import com.zyncro.api.exceptions.ZyncroApiException;

@ContextConfiguration(locations = { "classpath:/group/group-context.xml" })
public class GetOpenGroupInOtherOrg extends AbstractApiTest {

	@Value("#{staticgroups['user.external'].appId}")
	private String externalUserUrn;

	@Value("#{staticgroups['user.external'].password}")
	private String externalUserPassword;

	@Value("#{staticgroups['group.open.notMember.urn']}")
	private String openGroupUrn;

	@BeforeClass
	protected void loginUser() throws Exception {

		getApi().login(externalUserUrn, externalUserPassword);
	}

	@Test(expectedExceptions = { ZyncroApiException.class })
	public void testGetOpenGroup() throws ZyncroApiException {

		getApi().getService(IGroupApiService.class).getGroup(openGroupUrn);
	}
}
